<!doctype html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../css/style.css" />
		<script src="../js/head_public.js"></script>
		<script src="../js/common.js"></script>
		<script src="../js/session.js"></script>
	    <style>
	    	.store-list li{margin: 0px;border-bottom: 1px solid #EEEEEE;}
	    	.leibie{overflow: hidden;border-bottom: 1px solid #EEEEEE;background: #fff;height: 40px;}
	    	.leibie h4{width: 50%;float: left;line-height: 40px;margin: 0;font-weight: normal;text-align: center;}
	        .menban{top:85px}
	        .dizhi-list{background: #fff;position: fixed;top: 85px;width: 100%;}
	        .dizhi-list li{height: 30px;line-height: 30px;padding-left: 10px;color: #666666;overflow: hidden;padding-right: 0.2rem;}
	        .dizhi-list li span{float: right;}
	        .leibie-active{color: #ff7e00;}
	    </style>
	</head>
	<body>
		<header class="mui-bar mui-bar-nav ding-bar" >
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">家政服务</h1>
		</header>
		<div class="mui-content">
			<div class="leibie">
				<h4 data-type="1">区域</h4>
				<h4 data-type="2">类别</h4>
			</div>
			<!--下拉刷新容器-->
		    <div id="pullrefresh" class="newslist w620 mui-scroll-wrapper" style="position: static;">
				<!--数据列表-->
			    <div class="mui-scroll conferDiv" style="position: static;">
			    	<ul class="store-list" id="store-list">
			    		<!--<li>
			    			<a data-href="">
			    				<img  src="../images/goods.png"/>
			    				<div class="store-con">
			    					<h1 class="only-twoline">兰州新辉商店经营范围：经营范围：烟酒、饮料、雪</h1>
			    					<!--<p class="only-twoline">经营范围：经营范围：烟酒、饮料、雪糕、 日用品经营范围：经营范围：烟酒、饮料、雪糕、 日用品</p>-->
			    					<!--<button>企业认证</button>-->
			    					
			    				<!--div-->
			    			<!--</a>-->
			    			<!--<img src="../images/phone.png"  class="gm-phone-icon"/>-->
			    		<!--</li>-->
			    		<!--<li>-->
			    			<!--<a data-href="">-->
			    				<!--<img  src="../images/goods.png"/>-->
			    				<!--<div class="store-con">-->
			    					<!--<h1 class="only-twoline">兰州新辉商店</h1>-->
			    					<!--<p class="only-twoline">经营范围：经营范围：烟酒、饮料、雪糕、 日用品经营范围：经营范围：烟酒、饮料、雪糕、 日用品</p>-->
			    					<!--<button>企业认证</button>-->
			    					<!--<img src="../images/phone.png"  class="gm-phone-icon"/>-->
			    				<!--</div>-->
			    			<!--</a>-->
			    		<!--</li>-->
			    		<!--<li>-->
			    			<!--<a data-href="">-->
			    				<!--<img  src="../images/goods.png"/>-->
			    				<!--<div class="store-con">-->
			    					<!--<h1 class="only-twoline">兰州新辉商店</h1>-->
			    					<!--<p class="only-twoline">经营范围：经营范围：烟酒、饮料、雪糕、 日用品经营范围：经营范围：烟酒、饮料、雪糕、 日用品</p>-->
			    					<!--<button>企业认证</button>-->
			    					<!--<img src="../images/phone.png"  class="gm-phone-icon"/>-->
			    				<!--</div>-->
			    			<!--</a>-->
			    		<!--</li>-->
			    	</ul>
		        </div>
		    </div>
		</div>	
		<div class="zhifu-container">
			<div class="menban"></div>
				<ul class="dizhi-list">
					<!--<li>西固<span>&gt;</span></li>
					<li>西固<span>&gt;</span></li>
					<li>西固<span>&gt;</span></li>
					<li>西固<span>&gt;</span></li>
					<li>西固<span>&gt;</span></li>
					<li>西固<span>&gt;</span></li>
					<li>西固<span>&gt;</span></li>-->
				</ul>	
			</div>	
		<script src="../js/mui.min.js"></script>
		<script src="../js/jquery-1.8.0.min.js"></script>
		<script src="../js/iscroll.js"></script>
		<script>
			mui(".store-list").on("tap",".gm-phone-icon",function(){		
				location.href="tel:"+$(this).attr("data-href");
			})
		</script>
		<script>
		var type="";
		var home_type="";//居家养老的类型	
		var page=1;
			mui(".leibie").on("tap","h4",function(){
				type=$(this).attr("data-type");
				$(this).addClass("leibie-active").siblings("h4").removeClass("leibie-active");
				if(type!=null&&type!=""){
					if(type=="1"){
//						mui.openWindow({url:"../public/city.html"})
                        location.href="../public/city.html?t=yang"
//					//读取地区
//					$.post(net+"/public/index.php?s=api/shop/service_zone",{data:null},function(data){
//			               if(data.code==200){
//				               	if(data.result!=null&&data.result!=""&&data.result.length!=0){
//				               		var str="";
//				               		$.each(data.result, function(i,value) {
//				               	   	    str+='<li data-type="'+i+'">'+value+'<span>&gt;</span></li>'
//				               	   });
//				               	   $(".dizhi-list").empty();
//				               	   $(".dizhi-list").append(str);
//				               	}
//			               	  
//			               }
//						   },'json'
//						);
					}else if(type=="2"){
//						读取分类
						$.post(net+"/public/index.php?s=api/shop/household_class",{data:null},function(data){
			               if(data.code==200){
				               	if(data.result!=null&&data.result!=""&&data.result.length!=0){
				               		var str="";
				               		$.each(data.result, function(i,value) {
				               	   	    str+='<li data-type="'+this.id+'">'+this.name+'<span>&gt;</span></li>'
				               	   });
				               	   $(".dizhi-list").empty();
				               	   $(".dizhi-list").append(str);
				               	} 
			               }
						   },'json'
						);
					}
				}
				$(".zhifu-container").show();
			})

			mui(".dizhi-list").on("tap","li",function(){
				home_type=$(this).attr("data-type");
				$(this).addClass("leibie-active").siblings("h4").removeClass("leibie-active");
				page=1;
				$("#store-list").empty();
				getContents()
				$(".zhifu-container").hide();
				
			})
		</script>
		<script>
		mui.init()
		mui(".mui-content").on("tap","a",function(){
			mui.openWindow({url:$(this).attr("data-href")})
		}) 			
	    var $height = $(window).height();
		var $height1 = $("header").height();
		$(".mui-scroll-wrapper").height( $height - $height1 );
		
		mui.init({
				pullRefresh: {
					container: '#pullrefresh',
					down: {
						style:'circle',
						callback: pulldownRefresh
					},
					up: {
						contentrefresh: '正在加载...',
						callback: pullupRefresh
					}
				}
		});
			/**
		 * 下拉刷新具体业务实现
		 */
		function pulldownRefresh() {
			setTimeout(function() {
				mui('#pullrefresh').pullRefresh().endPulldownToRefresh();
				getContents();
			}, 1500);
		}
		/**
		 * 上拉加载具体业务实现
		 */
		function pullupRefresh() {
			setTimeout(function() {
				mui('#pullrefresh').pullRefresh().endPullupToRefresh(); //参数为true代表没有更多数据了。
				getContents();
			}, 1500);
		}
		function getContents(){
			
//		    读取列表
            data={};
            //判断区域id不为空时传入接口
            
            if(getQueryString("yang")!=null&&getQueryString("yang")!=""){
            	if(getCookie("townid")!=""&&getCookie("townid")!=null){
	          	    data.region_id=getCookie("townid");
	            }
            }
            var searchinfo=getQueryString("searchinfo");
            if(searchinfo!=null&&searchinfo!=""){
            	searchinfo=decodeURI(decodeURI(searchinfo));
            }
            //判断类别id部位空时传入接口
            if(home_type!=""&&home_type!=null){
            	data.home_type=home_type;
            }
            data.page=page;
            data.searchinfo=searchinfo;
			$.post(net+"/public/index.php?s=api/shop/household",data,function(data){
               if(data.code==200){
	               	if(data.result!=null&&data.result!=""&&data.result.length!=0){
	               		var str="";
	               		$.each(data.result, function(i,value) {
	               			var src=net+"public/uploads/home/store/"+this.store_id+"/"+this.store_avatar;
	               	   	    str+='<li><a data-href="info.html?id='+this.store_id+'"><img  src="'+src+'"/>'
	               	           +'<div class="store-con"><h1 class="only-twoline">'+this.store_name+'</h1><button>企业认证</button></div></a><img src="../images/phone.png"  class="gm-phone-icon" data-href="tel:'+this.store_phone+'"/></li>'    		
	               		});
	               	  
	               	   $("#store-list").append(str);
	               	   page++;
	               	}else{
	               		alert("没有更多数据")
	               	}
               }
			   },'json'
			);
		}
		getContents();


		</script>
	</body>

</html>